<template>
  <div style="padding: 20px">
    <el-tabs type="border-card">
      <el-tab-pane label="简历置顶">
        <el-table :data="listTop" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="days" label="服务时长" width="width">
            <template slot-scope="scope"> {{ scope.row.days }}天 </template>
          </el-table-column>
          <el-table-column prop="prop" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template> 允许全额兑换 </template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="is_recommend" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editTopResumeDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delTopBtn"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="mini"
          @click="addTopResumeDialog = true"
        >
          添加
        </el-button>
      </el-tab-pane>
      <el-tab-pane label="简历标签">
        <el-table :data="listLabel" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="days" label="服务时长" width="width">
            <template slot-scope="scope"> {{ scope.row.days }}天 </template>
          </el-table-column>
          <el-table-column prop="expense" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template> 允许全额兑换 </template>
          </el-table-column>
          <el-table-column prop="is_display" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editTabsResumeDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delTabsBtn"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="small"
          @click="addTabsResumeDialog = true"
        >
          添加
        </el-button>
      </el-tab-pane>
    </el-tabs>
    <addTopResume :addTopResumeDialog.sync="addTopResumeDialog" />
    <editTopResume :editTopResumeDialog.sync="editTopResumeDialog" />
    <addTabsResume :addTabsResumeDialog.sync="addTabsResumeDialog" />
    <editTabsResume :editTabsResumeDialog.sync="editTabsResumeDialog" />
  </div>
</template>

<script>
import addTopResume from "@/views/platformSystem/personConfig/addedServe/components/addTopResume";
import addTabsResume from "@/views/platformSystem/personConfig/addedServe/components/addTabsResume";
import editTopResume from "@/views/platformSystem/personConfig/addedServe/components/editTopResume";
import editTabsResume from "@/views/platformSystem/personConfig/addedServe/components/editTabsResume";
export default {
  components: {
    addTopResume,
    editTopResume,
    addTabsResume,
    editTabsResume,
  },
  data() {
    return {
      addTopResumeDialog: false,
      editTopResumeDialog: false,
      addTabsResumeDialog: false,
      editTabsResumeDialog: false,
      listTop: [
        {
          id: 1,
          name: "简历置顶3天",
          recommend: 0,
          days: 3,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "10.00",
          is_display: 1,
          sort_id: 0,
        },
        {
          id: 2,
          name: "简历置顶7天",
          recommend: 0,
          days: 7,
          expense: "2.00",
          enable_points_deduct: 1,
          deduct_max: "1.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "简历置顶30天",
          recommend: 0,
          days: 30,
          expense: "3.00",
          enable_points_deduct: 1,
          deduct_max: "5.00",
          is_display: 0,
          sort_id: 0,
        },
      ],
      listLabel: [
        {
          id: 1,
          name: "醒目标签3天",
          recommend: 0,
          days: 3,
          expense: "10.00",
          enable_points_deduct: 1,
          deduct_max: "5.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "醒目标签7天",
          recommend: 0,
          days: 7,
          expense: "20.00",
          enable_points_deduct: 1,
          deduct_max: "2.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "免费兑换1天",
          recommend: 0,
          days: 1,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 1,
          sort_id: 99,
        },
      ],
    };
  },
  methods: {
    delTopBtn() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    delTabsBtn() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
